import request from "./request.js"


/**
 * 省市区获取
 */
export function getOrganizationPage(data) {
	return request({
		url: '/business/api/common/organizationPage',
		method: 'GET',
		data
	})
}
/**
 * 省市区获取
 */
export function getProvincesList(data) {
	return request({
		url: '/business/api/comArea/findList',
		method: 'GET',
		data
	})
}
/**
 * 获取国家
 */
export function getNationalityPage(data) {
	return request({
		url: '/business/api/common/getNationalityPage',
		method: 'GET',
		data
	})
}

export function uploadFile(tempFilePaths) {
	let BASE_URL = getApp().globalData.BASE_URL
	let appType = 'APP'
	// #ifdef H5
	BASE_URL = '/api'
	appType = 'PC'
	// #endif
	const Token = uni.getStorageSync('token') || '';
	return new Promise((resolve, reject) => {
		uni.uploadFile({
			url: `${BASE_URL}/business/api/bothEndsCommon/sysFileInfo/upload`, //post请求的地址
			name: 'file',
			filePath: tempFilePaths,
			header: {
				appType: appType,
				Authorization: Token
			},
			success: (res) => {
				console.log('uploadFile**------------success', res)
				resolve(JSON.parse(res.data))
			},
			fail: (err) => {
				console.log('uploadFile------err------', err)
				reject(err)
			}
		})
	})
}